/* eslint valid-jsdoc: "off" */

'use strict';

/**
 * @param {Egg.EggAppInfo} appInfo app info
 */
module.exports = appInfo => {
  /**
   * built-in config
   * @type {Egg.EggAppConfig}
   **/
  const config = exports = {};

  // use for cookie sign key, should change to your own and keep security
  config.keys = appInfo.name + '_1675780319817_5571';

  // add your middleware config here
  config.middleware = [];
  
  // add your user config here
  const userConfig = {
    // myAppName: 'egg',
  };
  config.security = {
    csrf:{
      enable:false
    }
  }
  config.cors = {
    credentials: true,
    origin: '*', // 或者 origin: '*'  *代表所有来源都可访问
    allowMethods: 'GET,HEAD,PUT,POST,DELETE,PATCH,OPTIONS', //允许的请求方式  get、post等基本请求方式不需要设置
  }
  config.mongoose = {
    url: 'mongodb://127.0.0.1/manager',
    options: {}
  }
  config.jwt = {
    secret: '123456'
  };
  config.validate = {
    // 配置参数校验器，基于parameter
    convert: true, // 对参数可以使用 convertType 规则进行类型转换
    // validateRoot: false,   // 限制被验证值必须是一个对象。
    widelyUndefined: true
  }


  return {
    ...config,
    ...userConfig,
  };
};
